// pagesProperty/pages/event/result/index.js
var app = getApp(), fetchApi = require("../../../../utils/httpPost.js"), common_Js = require("../../../../component/common.js")
import Dialog from '../../../../component/vant/dialog/dialog';
import Toast from '../../../../component/vant/toast/toast';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    taskInfoId:0,
    isLoading: true,
    questionList:[],
    survey:{},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if(options.task_info_id){
      this.data.taskInfoId = options.task_info_id;
      this.onHttpInit();
    }
  },

  /**
   * 获取页面数据的 http请求
   */
  onHttpInit: function () {
    var that = this;
    fetchApi.httpPost('/survey/recordDetail', {
      task_info_id: that.data.taskInfoId
    }, function (res) {
      console.log("问卷答卷详情数据", res)
      if (res.data.code == 0) {
        that.setData({ 
          questionList: res.data.data.questions,
          survey: res.data.data.survey,
        })
      }
      
      that.setData({ 
        isLoading: false,
      })
      // complete
      wx.hideNavigationBarLoading() //完成停止加载
      wx.stopPullDownRefresh() //停止下拉刷新
    },function(){})
  },  
  preImg: function (t) {
    console.log("preSunImg", t)
    var a = t.currentTarget.dataset.imageindex, e = t.currentTarget.dataset.imgdata || [];
    var c = [];
    for (var index in e) {
      c.push(e[index])
    }
    common_Js.preImg(a, c)
  },
})